import { isDevMode } from '/@/utils/env';
import { useGlobSetting } from '/@/hooks/setting';

const globSetting = useGlobSetting();

// 缓存默认过期时间
export const DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7;

// 开启缓存加密后，加密密钥。采用aes加密
export const cacheCipher = {
  key: globSetting.dataTransmissionKey,
  iv: globSetting.dataTransmissionIv,
};

// 数据加密密钥
export const dataTransmissionCipher = {
  publickey: globSetting.dataTransmissionPublicKey,
  privatekey: globSetting.dataTransmissionPrivateKey,
  key: globSetting.dataTransmissionKey,
  iv: globSetting.dataTransmissionIv,
};

// 是否加密缓存，默认生产环境加密
export const enableStorageEncryption = !isDevMode();
